<?php

class Header extends MY_Controller 
{
	function __construct()
	{
		parent::__construct('header');
	}
	
	function index()
	{
		
		
		$data['title'] = $this->document->getTitle(); 
		
		if (isset($this->input->server['HTTPS']) && (($this->input->server['HTTPS'] == 'on') || ($this->input->server['HTTPS'] == '1'))) {
			$data['base'] = $this->cconfig->get('config_ssl');
		} else {
			$data['base'] = $this->cconfig->get('config_url');
		}
		
		$this->document->addStyle(base_url().'css/indexhtml.css');
		
		
		$data['description'] = $this->document->getDescription();
		$data['keywords'] = $this->document->getKeywords();
		$data['links'] = $this->document->getLinks();	
		$data['styles'] = $this->document->getStyles();
		$data['scripts'] = $this->document->getScripts();
		$data['lang'] = $this->lang->line('code');
		$data['charset'] = $this->lang->line('charset');
		$data['direction'] = $this->lang->line('direction');
		
		$data['google_analytics'] = html_entity_decode($this->cconfig->get('config_google_analytics'), ENT_QUOTES, 'UTF-8');
				
		$this->load->language('partial/header');
		
		
		
		
		$server = HTTP_IMAGE;
		if ($this->cconfig->get('config_icon') && file_exists(DIR_IMAGE . $this->cconfig->get('config_icon'))) {
			$data['icon'] = $server . $this->cconfig->get('config_icon');
		} else {
			$data['icon'] = '';
		}
		
		$data['name'] = $this->cconfig->get('config_name');
				
		if ($this->cconfig->get('config_logo') && file_exists(DIR_IMAGE . $this->cconfig->get('config_logo'))) {
			$data['logo'] = $server . $this->cconfig->get('config_logo');
		} else {
			$data['logo'] = '';
		}
		
		$data['text_home'] = $this->lang->line('text_home');
		
    	$data['text_search'] = $this->lang->line('text_search');
		$data['text_welcome'] = sprintf($this->lang->line('text_welcome'), site_url().'/account/login', site_url().'/account/register');
		$data['text_login'] = sprintf($this->lang->line('text_login'), site_url().'/account/login', site_url().'/account/register');
		$data['text_logged'] = sprintf($this->lang->line('text_logged'), site_url().'/account/account', $this->customer->getFirstName(), site_url().'/account/logout');
		$data['text_account'] = $this->lang->line('text_account');
				
		$data['home'] = site_url('/common/home');
		$data['logged'] = $this->customer->isLogged();
		$data['account'] = site_url('/account/account');

		
		$data['redirect'] = site_url('/common/home');
		
		
		
		return $this->load->view('partial/header', $data, true);
		
	}
	
}




?>